Skip to content

Make sure motion control returns to main thread before stopping - #490

Merged
urfeex merged 2 commits into
UniversalRobots:masterfrom
urfeex:avoid_error_popups
Apr 24, 2026
Merged

Make sure motion control returns to main thread before stopping#490
urfeex merged 2 commits into
UniversalRobots:masterfrom
urfeex:avoid_error_popups

Conversation

@urfeex

@urfeex urfeex commented Apr 21, 2026

Copy link
Copy Markdown
Member

When the watchdog times out, we halt in the external_control script and call stopj() just before that. However, ongoing motion will never happen in the main thread, but we always use a motion thread. Thus, calling stopj() here will result in an error that currently another thread is controlling the robot's motion.

Since we still want to stop the robot using the predefined deceleration, we have to stop all motion beforehand. Effectively returning motion control to the main thread before calling stopj().

Alternatively, we could remove the stopj() command (it is effectively not doing anything right now, anyway), but that would result in a very sudden stop of the robot.

This effectively fixes #479

When the watchdog times out, we halt in the external_control script and
call stopj() just before that. However, ongoing motion will never happen
in the main thread, but we always use a motion thread. Thus, calling
stopj() here will result in an error that currently another thread is
controlling the robot's motion.

Since we still want to stop the robot using the predefined deceleration,
we have to stop all motion beforehand. Effectively returning motion
control to the main thread before calling stopj().
@urfeex
urfeex requested a review from a team April 21, 2026 15:02
@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.28%. Comparing base (40bc3c8) to head (7a8334d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #490      +/-   ##
==========================================
- Coverage   76.40%   76.28%   -0.13%     
==========================================
  Files         113      113              
  Lines        6603     6603              
  Branches     2696     2696              
==========================================
- Hits         5045     5037       -8     
- Misses       1209     1215       +6     
- Partials      349      351       +2     
Flag Coverage Δ
python_scripts 75.90% <ø> (ø)
start_ursim 83.45% <ø> (-0.74%) ⬇️
ur20-latest 71.57% <ø> (-0.04%) ⬇️
ur5-3.14.3 71.67% <ø> (-0.05%) ⬇️
ur5e-10.11.0 65.70% <ø> (+0.25%) ⬆️
ur5e-10.12.0 66.96% <ø> (-0.07%) ⬇️
ur5e-10.7.0 64.80% <ø> (-0.23%) ⬇️
ur5e-5.9.4 72.07% <ø> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@urfeex urfeex added the bugfix label Apr 21, 2026
@urfeex
urfeex merged commit 4dda6d5 into UniversalRobots:master Apr 24, 2026
35 of 39 checks passed
@urfeex
urfeex deleted the avoid_error_popups branch April 24, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stopping the external_control program raises "Controlled by another thread"

2 participants